package com.lyn.pluginapi.factory

import java.util.concurrent.ConcurrentHashMap

/**
 *
 * @author longyn 2025/07/07
 * @version 1.0.0
 */
abstract class AbstractFactory<Param> {

    private val paramMap:MutableMap<String,Param> = ConcurrentHashMap()

     fun create(id:String,param: Param):Param{
         paramMap[id] = param
         return param
     }

     fun get(id:String):Param?{
         if (paramMap.containsKey(id)){
             return paramMap[id]
         }
         return null
     }

     fun remove(id:String):Param?{
         if (paramMap.containsKey(id)){
             val param = paramMap[id]
             paramMap.remove(id)
             return param
         }
         return null
     }
}